package com.platform.modules.report.service;

import com.platform.common.utils.MapUtil;
import com.platform.modules.report.dao.QlyAccReportDao;
import com.platform.modules.report.dao.QlyInsReportDao;
import com.platform.modules.report.dto.BaseQueryDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class QlyAccReportService  {


    @Autowired
    QlyAccReportDao qlyAccReportDao;


    public Integer qlyAccCount(Map<String, Object> params) {
        return  qlyAccReportDao.qlyAccCount(params);
    }

    public Map<String, Object> qlyAccCountGroupByType(BaseQueryDTO baseQueryDTO) {
        List<Map<String,Object>> list = qlyAccReportDao.qlyAccCountGroupByType(baseQueryDTO);
        return MapUtil.flat(list,"ACC_TYPE","COUNT");
    }

    public Map<String, Object> qlyAccCountGroupByCity(BaseQueryDTO baseQueryDTO) {
        List<Map<String,Object>> list = qlyAccReportDao.qlyAccCountGroupByCity(baseQueryDTO);
        return MapUtil.flat(list,"CITY_NUM","COUNT");
    }

    public Map<String, Object> qlyAccCountGroupByYear(BaseQueryDTO baseQueryDTO) {
        List<Map<String,Object>> list = qlyAccReportDao.qlyAccCountGroupByYear(baseQueryDTO);
        return MapUtil.flat(list,"YEAR","COUNT");
    }

    public Map<String, Object> qlyAccCountGroupByPrjCategory(BaseQueryDTO baseQueryDTO) {
        List<Map<String,Object>> list = qlyAccReportDao.qlyAccCountGroupByPrjCategory(baseQueryDTO);
        return MapUtil.flat(list,"PRJ_CATEGORY","COUNT");
    }



}
